﻿<!--#include file="../mae/mae.asp"-->
<%
res.Charset = "utf-8"

'初始化
Mo.Start "../mae/Mo", E_ERROR, E_LOG, E_WARNING

	'好了，开干
	F.echo "<h3>start</h3>"
	dim json_ : set json_ = JSON.create()
	json_.put("name", "mae for easp").put("create_on", F.formatdate(now,"yyyy-MM-dd HH:mm:ss")).put "by", "anlige"
	F.echo json_.toString(), true
	dump json_.data

	F.echo "<h3>SHA1、SHA256、MD5</h3>"
	F.echo SHA1("anlige"), true
	F.echo HMACSHA1("anlige", "admin"), true
	F.echo SHA256("anlige"), true
	F.echo HMACSHA256("anlige", "admin"), true
	F.echo MD5("anlige"), true
	F.echo HMACMD5("anlige", "admin"), true

	F.echo "<h3>Base64</h3>"
	F.echo Base64.encode("anlige"), true
	F.echo Base64.decode("YW5saWdl"), true
	F.echo Utf8.getString(Base64.d("YW5saWdl")), true

	F.echo "<h3>Crc32</h3>"
	F.echo Crc32("anlige"), true
	F.echo Crc32("艾恩"), true
	F.echo Crc32(GBK.getByteArray("艾恩")), true 'gbk编码的utf-8编码出来的结果是不一样的

	F.echo "<h3>JSON</h3>"
	'使用MAE的JSON
	dim json_3 : set json_3 = JSON.create(1)
	json_3.putObject().put("name", "anlige").put "age", 28
	json_3.putObject().put("name", "lilith").put "age", 24
	F.echo json_3.toString(), true '无格式

	F.echo "<pre>"
	F.echo json_3.toString(" "), true '传递缩进符，自动格式化
	F.echo "</pre>"
	
'必要的清理
Mo.End()
%>